import React from 'react';
import { Menu } from 'antd';
import { Link } from 'react-router-dom';
import { useSelector } from 'react-redux';
import type { IAppState } from '../../types/store';
import { RouterState } from 'connected-react-router';

const Navigation = () => {
  const router = useSelector<IAppState, RouterState>((state) => state.router);
  const pathname = router.location.pathname;
  console.log('pathname :', pathname);

  return (
    <Menu mode="horizontal">
      <Menu.Item key="home">
        <Link to="/">首页</Link>
      </Menu.Item>
      <Menu.Item key="shop">
        <Link to="/shop">商城</Link>
      </Menu.Item>
    </Menu>
  );
};

export default Navigation;
